<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>大家乐在线点餐系统</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="../../bootstrap/css/bootstrap.min.css">

    <link rel="stylesheet" href="../../dist/css/font-awesome.min.css">
    <link rel="stylesheet" href="../../dist/css/ionicons.min.css">
    <!-- DataTables -->
    <link rel="stylesheet" href="../../plugins/datatables/dataTables.bootstrap.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="../../dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="../../dist/css/skins/_all-skins.min.css">
    <link rel="stylesheet" href="../../css/admin.css">  

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.åjs"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="hold-transition skin-blue sidebar-mini">
    <div class="wrapper">
        <!-- 头部信息 -->
        <header class="main-header"></header>
        <!--  左侧导航 -->
        <aside class="main-sidebar"></aside>
    
        <!-- 内容区域 -->
        <div class="content-wrapper">
        <!-- 内容标题 -->
        <section class="content-header">
            <h1>
                <small>餐品库</small>/发布新餐品
            </h1>
            <!-- <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                <li><a href="#">门店管理</a></li>
                <li class="active">门店列表</li>
            </ol> -->
        </section>

        <!-- 内容区 -->
        <section class="content">
          <div class="row">
            <div class="col-xs-12">
              <!-- /.box -->
              <div class="box">
               
                <div class="box-body form-horizontal">
                    <h4 class="detail_title">
                        基础信息
                    </h4>
                    <div class="detail_con ">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><i class="red import">*</i>商品分类</label>
                            <div class="col-sm-4">
                                <select class="form-control">
                                    <option></option>
                                    <option>option 2</option>
                                    <option>option 3</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">所属时段</label>
                            <div class="col-sm-5">
                                <p class="form-control-static">早茶市</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><i class="red import">*</i>餐品类型</label>
                            <div class="col-sm-5">
                                <label class="checkbox-inline">
                                    <input type="checkbox"  value="option1">堂食餐品
                                </label>
                                <label class="checkbox-inline">
                                    <input type="checkbox"  value="option1">外卖餐品
                                </label>
                                <label class="checkbox-inline">
                                    <input type="checkbox"  value="option1">外带餐品
                                </label>
                            </div>
                        </div>
                    </div>
                        <h4 class="detail_title">
                            商品信息
                        </h4>
                        <div class="detail_con pad20">
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i class="red import">*</i>餐品名称</label>
                                <div class="col-sm-4">
                                    <input type="text" name="" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i class="red import">*</i>标准价格</label>
                                <div class="col-sm-4">
                                    <input type="text" name="" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i class="red import">*</i>支付方式</label>
                                <div class="col-sm-4">
                                    <select class="form-control">
                                        <option></option>
                                        <option>option 2</option>
                                        <option>option 3</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i class="red import">*</i>封面图片</label>
                                <div class="col-sm-1" id="preview">
                                     <img id="imghead" src="../img/pct.jpg" alt="" width="100" height="100">
                                </div>
                                <input type="file" id="pto" onchange="previewImage(this)" style="display:none;">
                                <!-- <div class="col-sm-1">
                                    <a href="javascript:;" class="delImg">删除</a>
                                </div> -->
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"></label>
                                <div class="col-sm-5">
                                    <p class='text-gray'>建议尺寸：640 x 640 像素。</p>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">详情封面图片</label>
                            
                                <div class="col-sm-1" id="preview2">
                                     <img id="imghead2" src="../img/pct.jpg" alt="" width="125" height="100">
                                </div>
                                <input type="file" id="pto2" onchange="previewImage2(this)" style="display:none;">
                                <!-- <div class="col-sm-1">
                                    <a href="javascript:;" class="delImg">删除</a>
                                </div> -->
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"></label>
                                <div class="col-sm-5">
                                    <p class='text-gray'>建议尺寸：800 x 640 像素；建议最多上4张图片。</p>
                                </div>
                            </div>
                            
                        </div>
                        <h4 class="detail_title">
                            库存信息
                        </h4>
                        <div class="detail_con pad20">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">餐品品种</label>
                                <div class="col-sm-4">
                                    <select class="form-control">
                                        <option>单品</option>
                                        <option>套餐</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i class="red import">*</i>总库存</label>
                                <div class="col-sm-4">
                                    <input type="text" name="" class="form-control">
                                </div>
                                <div class="col-sm-4">
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" value="">页面不显示商品库存
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"></label>
                                <div class="col-sm-4">
                                    <p class='text-gray'>总库存为 0 时，会上架到『已售罄的商品』列表里<br>发布后商品同步更新，以库存数字为准</p>
                                </div>
                            </div>
                            <!-- 套餐搭配餐品 -->
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">搭配餐品</label>
                                    <div class="col-sm-8">
                                        <!-- > -->
                                        <div class="">
                                            <table class="table table-bordered text-center">
                                                <thead>
                                                    <tr>
                                                        <th>餐品属性</th>
                                                        <th>餐品内容</th>
                                                        <th>补差价（元）</th>
                                                        <th>库存数</th>
                                                        <th>餐品编码</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td>
                                                            <input type="text" name="" class="form-control">
                                                        </td>
                                                        <td>
                                                            <input type="text" name="" class="form-control">
                                                        </td>
                                                        <td>
                                                            <input type="text" name="" class="form-control">
                                                        </td>
                                                        <td>
                                                            <input type="text" name="" class="form-control">
                                                        </td>
                                                        <td>
                                                            <input type="text" name="" class="form-control">
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <input type="text" name="" class="form-control">
                                                        </td>
                                                        <td>
                                                            <input type="text" name="" class="form-control">
                                                        </td>
                                                        <td>
                                                            <input type="text" name="" class="form-control">
                                                        </td>
                                                        <td>
                                                            <input type="text" name="" class="form-control">
                                                        </td>
                                                        <td>
                                                            <input type="text" name="" class="form-control">
                                                        </td>
                                                    </tr>
                                                </tbody>

                                            </table>
                                            <div>
                                                <button type="button" class="btn btn-flat btn-default btn-white w160">+添加</button>
                                                <span class="text-gray">搭配餐品的库存数不得超过餐品总库存</span>
                                            </div>
                                        </div>
                                    </div>
                                    
                                </div>
                            <!--  -->
                           
                            
                        </div>
                        <h4 class="detail_title">
                            物流／其它
                        </h4>
                        <div class="detail_con">
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i class="red import">*</i>配送设置</label>
                                <div class="col-sm-2"  style="width:100px;">
                                    <div class="radio">
                                        <label>
                                            <input type="radio" value="">配送费
                                        </label>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <input type="text" name="" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">每人限购</label>
                                <div class="col-sm-4">
                                    <input type="text" name="" class="form-control">
                                </div>
                                <div class="col-sm-4">
                                    <p class='text-gray'>0代表不限购</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">要求留言</label>
                                <div class="col-sm-4">
                                    <input type="text" name="" class="form-control">
                                </div>
                                <div class="col-sm-2">
                                    <select class="form-control">
                                        <option>文本格式</option>
                                        <option>数字格式</option>
                                        <option>身份证号</option>
                                    </select>
                                </div>
                                <div class="col-sm-2">
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" value="">必填
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">开售时间</label>
                                <div class="col-sm-4">
                                    <div class="radio">
                                        <label>
                                            <input type="radio" value="">立即开售
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"></label>
                                <div class="col-sm-2" style="width:110px;">
                                    <div class="radio">
                                        <label>
                                            <input type="radio" value="">定时开售
                                        </label>
                                    </div>
                                </div>
                                <div class="col-sm-2">
                                    <input type="text" name="" class="form-control">
                                </div>
                            </div>
                        </div>
                        <h4 class="detail_title">
                            促销推广
                        </h4>
                        <div class="detail_con">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">会员折扣</label>
                                <div class="col-sm-4">
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" value="">参加会员折扣
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">积分换购</label>
                                <div class="col-sm-4">
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" value="">立即开售
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"></label>
                                <div class="col-sm-4">
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" value="">参与积分换购
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </div>
                    
                    
                </div>
                <!-- /.box-body -->
                <div class="box-footer foot_bg align-center">                                   
                    <button type="submit" class="btn btn-flat btn-yellow"">确认提交</button>                
                    <button class="btn btn-flat btn-default btn-gray" type="button" onclick="history.go(-1)">取消</button>
                </div>
              </div>
            </div>
            <!-- /.col -->
          </div>
          <!-- /.row -->
        </section>
        <!-- /.content -->
      </div>
      <div class="control-sidebar-bg"></div>
    </div>
    <!-- ./wrapper -->

<!-- jQuery 2.2.3 -->
<script src="../../plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="../../bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="../../plugins/datatables/jquery.dataTables.min.js"></script>
<script src="../../plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="../../plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="../../plugins/fastclick/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="../../dist/js/app.min.js"></script>
<script src="../../dist/js/demo.js"></script>

<script type="text/javascript">
  var pageMenu = {"active": [2,22]};

  //图片上传预览    IE是用了滤镜。
        $("#preview").click(function(event) {
          $("#pto").hide().click();
        });
        function previewImage(file)
        {
          var MAXWIDTH  = 150; 
          var MAXHEIGHT = 100;
          var div = document.getElementById('preview');
          if (file.files && file.files[0])
          {
              div.innerHTML ='<img id=imghead>';
              var img = document.getElementById('imghead');
              img.onload = function(){
                var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
                img.width  =  rect.width;
                img.height =  rect.height;
//                 img.style.marginLeft = rect.left+'px';
                img.style.marginTop = rect.top+'px';
              }
              var reader = new FileReader();
              reader.onload = function(evt){img.src = evt.target.result;}
              reader.readAsDataURL(file.files[0]);
          }
          else //兼容IE
          {
            var sFilter='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';
            file.select();
            var src = document.selection.createRange().text;
            div.innerHTML = '<img id=imghead>';
            var img = document.getElementById('imghead');
            img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = src;
            var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
            status =('rect:'+rect.top+','+rect.left+','+rect.width+','+rect.height);
            div.innerHTML = "<div id=divhead style='width:"+rect.width+"px;height:"+rect.height+"px;margin-top:"+rect.top+"px;"+sFilter+src+"\"'></div>";
          }
        }
        function clacImgZoomParam( maxWidth, maxHeight, width, height ){
            var param = {top:0, left:0, width:width, height:height};
            if( width>maxWidth || height>maxHeight )
            {
                rateWidth = width / maxWidth;
                rateHeight = height / maxHeight;
                 
                if( rateWidth > rateHeight )
                {
                    param.width =  maxWidth;
                    param.height = Math.round(height / rateWidth);
                }else
                {
                    param.width = Math.round(width / rateHeight);
                    param.height = maxHeight;
                }
            }
            param.left = Math.round((maxWidth - param.width) / 2);
            param.top = Math.round((maxHeight - param.height) / 2);
            return param;
        }

        $("#preview2").click(function(event) {
          $("#pto2").hide().click();
        });
        function previewImage2(file)
        {
          var MAXWIDTH  = 150; 
          var MAXHEIGHT = 100;
          var div = document.getElementById('preview2');
          if (file.files && file.files[0])
          {
              div.innerHTML ='<img id=imghead2>';
              var img = document.getElementById('imghead2');
              img.onload = function(){
                var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
                img.width  =  rect.width;
                img.height =  rect.height;
//                 img.style.marginLeft = rect.left+'px';
                img.style.marginTop = rect.top+'px';
              }
              var reader = new FileReader();
              reader.onload = function(evt){img.src = evt.target.result;}
              reader.readAsDataURL(file.files[0]);
          }
          else //兼容IE
          {
            var sFilter='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';
            file.select();
            var src = document.selection.createRange().text;
            div.innerHTML = '<img id=imghead2>';
            var img = document.getElementById('imghead2');
            img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = src;
            var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
            status =('rect:'+rect.top+','+rect.left+','+rect.width+','+rect.height);
            div.innerHTML = "<div id=divhead2 style='width:"+rect.width+"px;height:"+rect.height+"px;margin-top:"+rect.top+"px;"+sFilter+src+"\"'></div>";
          }
        }
        function clacImgZoomParam( maxWidth, maxHeight, width, height ){
            var param = {top:0, left:0, width:width, height:height};
            if( width>maxWidth || height>maxHeight )
            {
                rateWidth = width / maxWidth;
                rateHeight = height / maxHeight;
                 
                if( rateWidth > rateHeight )
                {
                    param.width =  maxWidth;
                    param.height = Math.round(height / rateWidth);
                }else
                {
                    param.width = Math.round(width / rateHeight);
                    param.height = maxHeight;
                }
            }
            param.left = Math.round((maxWidth - param.width) / 2);
            param.top = Math.round((maxHeight - param.height) / 2);
            return param;
        }
</script>
<script src="../../js/vendors.js" type="text/javascript"></script>
<script src="../../js/index.js" type="text/javascript"></script>
  
</body>
</html>